package org.hackystat.ui.projectviewer.gwt.client.dataprovider;

import java.util.List;

import org.hackystat.ui.projectviewer.gwt.client.common.types.ProjectData;
import org.hackystat.ui.projectviewer.gwt.client.common.types.ProjectDevSummary;
import org.hackystat.ui.projectviewer.gwt.client.common.types.ProjectSummaryData;
import org.hackystat.ui.projectviewer.gwt.client.common.types.ProjectViewerProperties;

import com.google.gwt.user.client.rpc.AsyncCallback;

/**
 * The interface for the RPC server endpoint that provides school calendar information for clients
 * that will be calling asynchronously.
 *
 * @author Pavel Senin.
 */
public interface ProjectViewerDataProviderAsync {

  /**
   * Confirms sensorbase host provided.
   *
   * @param host The host URL.
   * @param callback The GWT RPC thingy which returned when success or timeout (unable to
   *        communicate event) happened.
   */
  public void confirmSensorbaseHost(String host, AsyncCallback<Boolean> callback);

  /**
   * Confirms DPD host provided.
   *
   * @param host The host URL.
   * @param callback The GWT RPC thingy which returned when success or timeout (unable to
   *        communicate event) happened.
   */
  public void confirmDPDHost(String host, AsyncCallback<Boolean> callback);

  /**
   * Confirms Telemetry host provided.
   *
   * @param host The host URL.
   * @param callback The GWT RPC thingy which returned when success or timeout (unable to
   *        communicate event) happened.
   */
  public void confirmTelemetryHost(String host, AsyncCallback<Boolean> callback);

  /**
   * Authorizes client with sensorbase.
   *
   * @param host The sensorbase host.
   * @param user The user name.
   * @param password The password.
   * @param callback The GWT RPC thingy.
   */
  public void confirmUser(String host, String user, String password,
      AsyncCallback<Boolean> callback);

  /**
   * Reports list of all projects for authorized user.
   *
   * @param host The sensorbase host.
   * @param user The user name.
   * @param password The password.
   * @param callback The GWT RPC thingy.
   */
  public void getProjectIndex(String host, String user, String password,
      AsyncCallback<List<String>> callback);

  /**
   * Reports list of all invitations for authorized user.
   *
   * @param host The sensorbase host.
   * @param user The user name.
   * @param password The password.
   * @param callback The GWT RPC thingy.
   */
  public void getInvitationsList(String host, String user, String password,
      AsyncCallback<List<String>> callback);

  /**
   * Reports project information.
   *
   * @param host The sensorbase host.
   * @param user The user name.
   * @param password The password.
   * @param projectName The project name.
   * @param callback The GWT RPC thingy.
   */
  public void getProjectData(String host, String user, String password, String projectName,
      AsyncCallback<ProjectData> callback);

  /**
   * Creates new project record.
   *
   * @param host The sensorbase host.
   * @param user The user name.
   * @param password The password.
   * @param pd The project data to insert.
   * @param callback The GWT RPC thingy.
   */
  public void putProjectData(String host, String user, String password, ProjectData pd,
      AsyncCallback<Boolean> callback);

  /**
   * Deletes project record.
   *
   * @param host The sensorbase host.
   * @param user The user name.
   * @param password The password.
   * @param projectName The project name to delete.
   * @param callback The GWT RPC thingy.
   */
  public void deleteProject(String host, String user, String password, String projectName,
      AsyncCallback<Boolean> callback);

  /**
   * Retrieves configured properties from the server side user home.
   *
   * @param callback The GWT RPC thingy.
   */
  public void getProjectViewerProperties(AsyncCallback<ProjectViewerProperties> callback);

  /**
   * Gets the actual sensor data from sensorbase.
   *
   * @param host The sensorbase host.
   * @param user The user name.
   * @param password The password.
   * @param startRow The row to start data set from.
   * @param maxRows The max amount of rows to fetch.
   * @param projectName The project name to get data for.
   * @param projectOwner The project owner.
   * @param asyncCallback GWT thingy.
   */
  public void getSensorData(String host, String user, String password, int startRow, int maxRows,
      String projectName, String projectOwner, AsyncCallback<String[]> asyncCallback);

  /**
   * Registers new user with sensorbase.
   *
   * @param host The sensorbase host.
   * @param newUser The user e-mail.
   * @param callback The GWT RPC thingy.
   */
  public void registerUser(String host, String newUser, AsyncCallback<Boolean> callback);

  /**
   * Accepts invitation.
   *
   * @param host The sensorbase host.
   * @param user The user name.
   * @param password The password.
   * @param projectName The project name.
   * @param callback The GWT RPC thingy.
   */
  public void acceptInvitation(String host, String user, String password, String projectName,
      AsyncCallback<Boolean> callback);

  /**
   * Declines invitation.
   *
   * @param host The sensorbase host.
   * @param user The user name.
   * @param password The password.
   * @param projectName The project name.
   * @param callback The GWT RPC thingy.
   */
  public void declineInvitation(String host, String user, String password, String projectName,
      AsyncCallback<Boolean> callback);

  /**
   * Reports the exception code from app server side.
   *
   * @param callback The GWT RPC thingy.
   */
  public void getExceptionMessage(AsyncCallback<String> callback);

  /**
   * Gets the project extended summary.
   *
   * @param sensorbaseHost The sensorbase host.
   * @param dpdHost The sensorbase host.
   * @param user The user name.
   * @param password The password.
   * @param projectId The project name.
   * @param callback The GWT thingy.
   */
  public void getProjectSummaryData(String sensorbaseHost, String dpdHost, String user,
      String password, String projectId, AsyncCallback<ProjectSummaryData> callback);

  /**
   * Gets the project development data summary.
   *
   * @param telemetryHost The telemetry host.
   * @param user The user name.
   * @param password The password.
   * @param projectId The project name.
   * @param owner The project owner.
   * @param callback The GWT thingy.
   */
  public void getProjectDevTimeData(String telemetryHost, String user, String password,
      String projectId, String owner, AsyncCallback<ProjectDevSummary> callback);

  /**
   * Fires data download.
   *
   * @param sensorbaseHost The sensorbase host.
   * @param user The user name.
   * @param password The password.
   * @param projectId The project name.
   * @param sdtType The sdt type.
   * @param asyncCallback The GWT thingy.
   */
  public void fireDataDownload(String sensorbaseHost, String user, String password,
      String projectId, String sdtType, AsyncCallback<Boolean> asyncCallback);

}
